package com.fm.openinstall.e;

import com.fm.openinstall.f.*;

import android.content.*;
import android.app.*;

import java.util.*;

public class d extends a {
    private c c;
    private int d;
    private volatile boolean e;

    public d(final Context context, final f f) {
        super(context, f);
        this.c = com.fm.openinstall.f.c.a(d.class);
        this.d = 0;
        this.e = true;
    }

    private void a(long n) {
        for (final ActivityManager.RunningAppProcessInfo activityManager : ((ActivityManager) this.a.getSystemService("activity")).getRunningAppProcesses()) {
            if (activityManager.processName.equals(this.a.getPackageName())) {
                if (activityManager.importance == 100) {
                    if (this.d != 1) {
                        n = 0L;
                        this.d = 1;
                    } else {
                        ++n;
                    }
                } else {
                    if (this.d == -1) {
                        continue;
                    }
                    this.d = -1;
                    this.b.b(n);
                }
            }
        }
    }

    @Override
    public void a() {
        this.e = true;
        final Thread thread = new Thread(new e(this));
        thread.setName("LoopAliveTask");
        thread.start();
    }

    @Override
    public void b() {
        this.e = false;
    }
}
